package com.ljq.rpc.client.Listens;

import com.ljq.rpc.annotations.ClientComponent;
import com.ljq.rpc.annotations.Deposit;
import com.ljq.rpc.client.config.NettyClient;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.context.ApplicationListener;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;

@ClientComponent
public class ProxyApplicationListener implements ApplicationListener<ContextRefreshedEvent> {

    private volatile AtomicBoolean isInit=new AtomicBoolean(false);

    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        if(!isInit.compareAndSet(false,true)) {
            return;
        }
//        try {
//            start(event);
//        } catch (InterruptedException e) {
//            e.printStackTrace();
//        }
    }


}
